package admincow.servlet.toro;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import admincow.dao.ToroDAO;
import admincow.vo.ToroVO;


/**
 * Servlet implementation class for Servlet: UsuarioModificarServlet
 * 
 */
public class ToroModificarServlet extends javax.servlet.http.HttpServlet
		implements javax.servlet.Servlet {
	static final long serialVersionUID = 1L;

	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public ToroModificarServlet() {
		super();
	}

	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request,
	 *      HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request,
	 *      HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		System.out.println("Ingresando a toro modificar");
		String a = request.getParameter("RPtoro");
		System.out.println(a);
		int b = Integer.parseInt(request.getParameter("idraza"));
		System.out.println(b);
		String c = request.getParameter("nombre");
		String d = request.getParameter("RPpadre");
		String e = request.getParameter("RPmadre");
		String f = request.getParameter("apodo");
		int g = Integer.parseInt(request.getParameter("canastilla"));
		int h = Integer.parseInt(request.getParameter("cantidad"));
		int i = Integer.parseInt(request.getParameter("precio"));
		int j = Integer.parseInt(request.getParameter("prec_total"));
			
				ToroVO vo = new ToroVO();
						
		vo.setRPtoro(a);
		vo.setIdraza(b);
		vo.setNombre(c);
		vo.setRPpadre(d);
		vo.setRPmadre(e);
		vo.setApodo(f);
		vo.setCanastilla(g);
		vo.setCantidad(h);
		vo.setPrecio(i);
		vo.setPrec_total(j);

		
		ToroDAO dao = new ToroDAO();
		dao.actualizar(vo);

		RequestDispatcher rd = request
				.getRequestDispatcher("/toroBuscar.jsp");
		rd.forward(request, response);

	}
}